package com.wu.client.controller;

import com.wu.client.service.RankService;
import com.wu.client.vo.res.rank.RankDetailResp;
import com.wu.client.vo.res.rank.RankResp;
import com.wu.common.convertion.result.Result;
import com.wu.common.convertion.result.Results;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Cousin
 * @date 2025/3/23
 * @Description
 */
@RestController
@RequestMapping("rankings")
@RequiredArgsConstructor
public class RankController {
    private final RankService rankService;

    @GetMapping
    public Result<List<RankResp>> getRankings(){
        return Results.success(rankService.getRanks());
    }
    @GetMapping("{rankId}")
    public Result<List<RankDetailResp>> getRankDetail(@PathVariable String rankId){
        return Results.success(rankService.getRankDetail(rankId));
    }


}
